package ACWing.TheNnderlyingAlgorithm.高精度;
//791. 高精度加法
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2022/11/25 8:47
 */
public class HighPrecisionAddition {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String n=sc.next();
        String m=sc.next();
        char[] char1 = n.toCharArray();
        char[] char2 = m.toCharArray();
        //将个位数放在第一位以此类推这样计算使不用考虑位数
        int[]arr=new int[Math.max(n.length(),m.length())];
        for (int i = n.length()-1,j=0; i >=0; i--,j++) {
            arr[i]=char1[j]-'0';
        }
        int[]arr2=new int[Math.max(n.length(),m.length())];
        for (int i = m.length()-1,j=0; i >=0 ; i--,j++) {
            arr2[i]=char2[j]-'0';
        }
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.toString(arr2));
        ArrayList list=new ArrayList();
        //模拟加法满10进1
        int t=0;//表示进位
        for (int i = 0; i < arr.length; i++) {
            arr[i]=arr[i]+t;
            int num = arr[i] + arr2[i];
            //判断现在是否到最后一位如果是则不需要进位直接存下来便可以
            if(i==arr.length-1){
                list.add(num);
                break;
            }
            list.add(num%10);
            t=num/10;

        }
        for (int i = list.size()-1; i >=0 ; i--) {
            System.out.print(list.get(i));
        }
    }

}
